/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('servicecatalog', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ApproveProvisionedProductPlanRequest {
  approvalAction?: string(name='ApprovalAction', description='The review action. Valid values:

*   Approve
*   Reject', example='Approve'),
  comment?: string(name='Comment', description='The review description.', example='Approved. You can create a resource.'),
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
}

model ApproveProvisionedProductPlanResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ApproveProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ApproveProvisionedProductPlanResponseBody(name='body'),
}

async function approveProvisionedProductPlanWithOptions(request: ApproveProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): ApproveProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.approvalAction)) {
    body['ApprovalAction'] = request.approvalAction;
  }
  if (!Util.isUnset(request.comment)) {
    body['Comment'] = request.comment;
  }
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ApproveProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function approveProvisionedProductPlan(request: ApproveProvisionedProductPlanRequest): ApproveProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return approveProvisionedProductPlanWithOptions(request, runtime);
}

model AssociatePrincipalWithPortfolioRequest {
  portfolioId?: string(name='PortfolioId', example='port-bp1yt7582g****'),
  principalId?: string(name='PrincipalId', example='24477111603637****'),
  principalType?: string(name='PrincipalType', example='RamUser'),
}

model AssociatePrincipalWithPortfolioResponseBody = {
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model AssociatePrincipalWithPortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AssociatePrincipalWithPortfolioResponseBody(name='body'),
}

async function associatePrincipalWithPortfolioWithOptions(request: AssociatePrincipalWithPortfolioRequest, runtime: Util.RuntimeOptions): AssociatePrincipalWithPortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.principalId)) {
    body['PrincipalId'] = request.principalId;
  }
  if (!Util.isUnset(request.principalType)) {
    body['PrincipalType'] = request.principalType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AssociatePrincipalWithPortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function associatePrincipalWithPortfolio(request: AssociatePrincipalWithPortfolioRequest): AssociatePrincipalWithPortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return associatePrincipalWithPortfolioWithOptions(request, runtime);
}

model AssociateProductWithPortfolioRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model AssociateProductWithPortfolioResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model AssociateProductWithPortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AssociateProductWithPortfolioResponseBody(name='body'),
}

async function associateProductWithPortfolioWithOptions(request: AssociateProductWithPortfolioRequest, runtime: Util.RuntimeOptions): AssociateProductWithPortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AssociateProductWithPortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function associateProductWithPortfolio(request: AssociateProductWithPortfolioRequest): AssociateProductWithPortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateProductWithPortfolioWithOptions(request, runtime);
}

model AssociateTagOptionWithResourceRequest {
  resourceId?: string(name='ResourceId', description='The ID of the resource with which the tag option is associated.', example='port-bp15p96922****'),
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
}

model AssociateTagOptionWithResourceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='DC833558-AFF4-5935-9AB6-8A12EE7D****'),
}

model AssociateTagOptionWithResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AssociateTagOptionWithResourceResponseBody(name='body'),
}

async function associateTagOptionWithResourceWithOptions(request: AssociateTagOptionWithResourceRequest, runtime: Util.RuntimeOptions): AssociateTagOptionWithResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.tagOptionId)) {
    body['TagOptionId'] = request.tagOptionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AssociateTagOptionWithResource',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function associateTagOptionWithResource(request: AssociateTagOptionWithResourceRequest): AssociateTagOptionWithResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateTagOptionWithResourceWithOptions(request, runtime);
}

model CancelProvisionedProductPlanRequest {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
}

model CancelProvisionedProductPlanResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CancelProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CancelProvisionedProductPlanResponseBody(name='body'),
}

async function cancelProvisionedProductPlanWithOptions(request: CancelProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): CancelProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function cancelProvisionedProductPlan(request: CancelProvisionedProductPlanRequest): CancelProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelProvisionedProductPlanWithOptions(request, runtime);
}

model CopyProductRequest {
  sourceProductArn?: string(name='SourceProductArn', description='The Alibaba Cloud Resource Name (ARN) of the source product.

> The source product can belong to the current account or belong to a product portfolio that is shared by another account.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
  targetProductName?: string(name='TargetProductName', description='The name of the destination product.', example='DEMO-ECS'),
}

model CopyProductResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
}

model CopyProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CopyProductResponseBody(name='body'),
}

async function copyProductWithOptions(request: CopyProductRequest, runtime: Util.RuntimeOptions): CopyProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.sourceProductArn)) {
    body['SourceProductArn'] = request.sourceProductArn;
  }
  if (!Util.isUnset(request.targetProductName)) {
    body['TargetProductName'] = request.targetProductName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CopyProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function copyProduct(request: CopyProductRequest): CopyProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return copyProductWithOptions(request, runtime);
}

model CreateConstraintRequest {
  config?: string(name='Config', description='The configuration of the constraint.

Format: { "LocalRoleName": "\\<role_name>" }.', example='{ "LocalRoleName": "TestRole" }'),
  constraintType?: string(name='ConstraintType', description='The type of the constraint.

The value is fixed as Launch, which specifies the launch constraint.', example='Launch'),
  description?: string(name='Description', description='The description of the constraint.

The value must be 1 to 128 characters in length.', example='Launch as local role TestRole'),
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio to which the constraint belongs.', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product for which the constraint is created.', example='prod-bp18r7q127****'),
}

model CreateConstraintResponseBody = {
  constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CreateConstraintResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateConstraintResponseBody(name='body'),
}

async function createConstraintWithOptions(request: CreateConstraintRequest, runtime: Util.RuntimeOptions): CreateConstraintResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.config)) {
    body['Config'] = request.config;
  }
  if (!Util.isUnset(request.constraintType)) {
    body['ConstraintType'] = request.constraintType;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateConstraint',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createConstraint(request: CreateConstraintRequest): CreateConstraintResponse {
  var runtime = new Util.RuntimeOptions{};
  return createConstraintWithOptions(request, runtime);
}

model CreatePortfolioRequest {
  description?: string(name='Description', description='The description of the product portfolio.

The value must be 1 to 128 characters in length.', example='The description of the product portfolio.'),
  portfolioName?: string(name='PortfolioName', description='The name of the product portfolio.

The value must be 1 to 128 characters in length.', example='DEMO-IT services'),
  providerName?: string(name='ProviderName', description='The provider of the product portfolio.

The value must be 1 to 128 characters in length.', example='IT team'),
}

model CreatePortfolioResponseBody = {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CreatePortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePortfolioResponseBody(name='body'),
}

async function createPortfolioWithOptions(request: CreatePortfolioRequest, runtime: Util.RuntimeOptions): CreatePortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.portfolioName)) {
    body['PortfolioName'] = request.portfolioName;
  }
  if (!Util.isUnset(request.providerName)) {
    body['ProviderName'] = request.providerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPortfolio(request: CreatePortfolioRequest): CreatePortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPortfolioWithOptions(request, runtime);
}

model CreateProductRequest {
  description?: string(name='Description', description='The description of the product.

The value must be 1 to 128 characters in length.', example='The description of the product.'),
  productName?: string(name='ProductName', description='The name of the product.

The value must be 1 to 128 characters in length.', example='DEMO-Create an ECS instance'),
  productType?: string(name='ProductType', description='The type of the product.

Set the value to Ros, which specifies Resource Orchestration Service (ROS).', example='Ros'),
  productVersionParameters?: {
    active?: boolean(name='Active', description='Specifies whether to enable the product version. Valid values:

*   true: enables the product version. This is the default value.
*   false: disables the product version.', example='true'),
    description?: string(name='Description', description='The description of the product version.

The value must be 1 to 128 characters in length.', example='The description of the product version.'),
    guidance?: string(name='Guidance', description='The recommendation information. Valid values:

*   Default: No recommendation information is provided. This is the default value.
*   Recommended: the recommended version.
*   Latest: the latest version.
*   Deprecated: the version that is about to be discontinued.', example='Default'),
    productVersionName?: string(name='ProductVersionName', description='The name of the product version.

The value must be 1 to 128 characters in length.', example='1.0'),
    templateType?: string(name='TemplateType', description='The type of the template.

Set the value to RosTerraformTemplate, which specifies the Terraform template that is supported by ROS.', example='RosTerraformTemplate'),
    templateUrl?: string(name='TemplateUrl', description='The URL of the template.

For more information about how to obtain the URL of a template, see [CreateTemplate](~~CreateTemplate~~).', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
  }(name='ProductVersionParameters', description='The information about the product version.'),
  providerName?: string(name='ProviderName', description='The provider of the product.

The value must be 1 to 128 characters in length.', example='IT team'),
}

model CreateProductShrinkRequest {
  description?: string(name='Description', description='The description of the product.

The value must be 1 to 128 characters in length.', example='The description of the product.'),
  productName?: string(name='ProductName', description='The name of the product.

The value must be 1 to 128 characters in length.', example='DEMO-Create an ECS instance'),
  productType?: string(name='ProductType', description='The type of the product.

Set the value to Ros, which specifies Resource Orchestration Service (ROS).', example='Ros'),
  productVersionParametersShrink?: string(name='ProductVersionParameters', description='The information about the product version.'),
  providerName?: string(name='ProviderName', description='The provider of the product.

The value must be 1 to 128 characters in length.', example='IT team'),
}

model CreateProductResponseBody = {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CreateProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateProductResponseBody(name='body'),
}

/**
  * Before you call the CreateProduct operation, you must call the [CreateTemplate](~~CreateTemplate~~) operation to create a template.
  *
  * @param tmpReq CreateProductRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return CreateProductResponse
 */
async function createProductWithOptions(tmpReq: CreateProductRequest, runtime: Util.RuntimeOptions): CreateProductResponse {
  Util.validateModel(tmpReq);
  var request = new CreateProductShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.productVersionParameters)) {
    request.productVersionParametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.productVersionParameters, 'ProductVersionParameters', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.productName)) {
    body['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.productVersionParametersShrink)) {
    body['ProductVersionParameters'] = request.productVersionParametersShrink;
  }
  if (!Util.isUnset(request.providerName)) {
    body['ProviderName'] = request.providerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * Before you call the CreateProduct operation, you must call the [CreateTemplate](~~CreateTemplate~~) operation to create a template.
  *
  * @param request CreateProductRequest
  * @return CreateProductResponse
 */
async function createProduct(request: CreateProductRequest): CreateProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProductWithOptions(request, runtime);
}

model CreateProductVersionRequest {
  active?: boolean(name='Active', description='Specifies whether the product version is active. Valid values:

*   true: The product version is active. This is the default value.
*   false: The product version is inactive.', example='true'),
  description?: string(name='Description', description='The description of the product version.

The value must be 1 to 128 characters in length.', example='The description of the product version.'),
  guidance?: string(name='Guidance', description='The recommendation information. Valid values:

*   Default: No recommendation information is provided. This is the default value.
*   Recommended: the recommendation version.
*   Latest: the latest version.
*   Deprecated: the version that is about to be discontinued.', example='Default'),
  productId?: string(name='ProductId', description='The ID of the product to which the product version belongs.', example='prod-bp18r7q127****'),
  productVersionName?: string(name='ProductVersionName', description='The name of the product version.

The value must be 1 to 128 characters in length.', example='1.0'),
  templateType?: string(name='TemplateType', description='The type of the template.

The value is fixed as RosTerraformTemplate, which specifies the Terraform template that is supported by Resource Orchestration Service (ROS).', example='RosTerraformTemplate'),
  templateUrl?: string(name='TemplateUrl', description='The URL of the template.

For more information about how to obtain the URL of a template, see [CreateTemplate](~~CreateTemplate~~).', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
}

model CreateProductVersionResponseBody = {
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CreateProductVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateProductVersionResponseBody(name='body'),
}

/**
  * Before you call the CreateProductVersion operation, you must call the [CreateTemplate](~~CreateTemplate~~) operation to create a template.
  *
  * @param request CreateProductVersionRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return CreateProductVersionResponse
 */
async function createProductVersionWithOptions(request: CreateProductVersionRequest, runtime: Util.RuntimeOptions): CreateProductVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.active)) {
    body['Active'] = request.active;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.guidance)) {
    body['Guidance'] = request.guidance;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionName)) {
    body['ProductVersionName'] = request.productVersionName;
  }
  if (!Util.isUnset(request.templateType)) {
    body['TemplateType'] = request.templateType;
  }
  if (!Util.isUnset(request.templateUrl)) {
    body['TemplateUrl'] = request.templateUrl;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateProductVersion',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * Before you call the CreateProductVersion operation, you must call the [CreateTemplate](~~CreateTemplate~~) operation to create a template.
  *
  * @param request CreateProductVersionRequest
  * @return CreateProductVersionResponse
 */
async function createProductVersion(request: CreateProductVersionRequest): CreateProductVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProductVersionWithOptions(request, runtime);
}

model CreateProvisionedProductPlanRequest {
  description?: string(name='Description', description='The description of the plan.

The value must be 1 to 128 characters in length.', example='Create an ECS instance.'),
  operationType?: string(name='OperationType', description='The type of the operation that you want the plan to perform. Valid values:

*   LaunchProduct: launches the product. This is the default value.
*   UpdateProvisionedProduct: updates the information about the product instance.
*   TerminateProvisionedProduct: terminates the product instance.', example='LaunchProduct'),
  parameters?: [ 
    {
      parameterKey?: string(name='ParameterKey', description='The name of the parameter in the template.', example='instance_type'),
      parameterValue?: string(name='ParameterValue', description='The value of the parameter in the template.', example='ecs.s6-c1m1.small'),
    }
  ](name='Parameters', description='An array that consists of the parameters in the template.

You can specify up to 200 parameters.

> If you specify Parameters, you must specify ParameterKey and ParameterValue.'),
  planName?: string(name='PlanName', description='The plan name.

The value must be 1 to 128 characters in length.', example='DEMO-ECS instance'),
  planType?: string(name='PlanType', description='The plan type.

Set the value to Ros, which specifies Resource Orchestration Service (ROS).', example='Ros'),
  portfolioId?: string(name='PortfolioId', description='The product portfolio ID.

> If PortfolioId is not required, you do not need to specify PortfolioId. If PortfolioId is required, you must specify PortfolioId. For more information about how to obtain the value of PortfolioId, see [ListLaunchOptions](~~ListLaunchOptions~~).', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The product ID.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The product version ID.', example='pv-bp15e79d26****'),
  provisionedProductName?: string(name='ProvisionedProductName', description='The product instance name.

The value must be 1 to 128 characters in length.', example='DEMO-ECS instance'),
  stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the ROS stack belongs.

For more information about how to obtain the regions that are supported by ROS, see [DescribeRegions](~~131035~~).', example='cn-hangzhou'),
  tags?: [ 
    {
      key?: string(name='Key', description='The key of the custom tag.

The key can be up to 128 characters in length, and cannot start with `acs:` or `aliyun`. The tag key cannot contain `http://` or `https://`.', example='k1'),
      value?: string(name='Value', description='The value of the custom tag.

The value can be up to 128 characters in length, and cannot start with `acs:`. The tag value cannot contain `http://` or `https://`.', example='v1'),
    }
  ](name='Tags', description='An array that consists of custom tags.

Maximum value of N: 20.

> 
*   If you specify Tags, you must specify Tags.N.Key and Tags.N.Value.
*   The tag of a stack is propagated to each resource that supports the tag feature in the stack.'),
}

model CreateProvisionedProductPlanResponseBody = {
  planId?: string(name='PlanId', description='The plan ID.', example='plan-bp1jvmdk2k****'),
  provisionedProductId?: string(name='ProvisionedProductId', description='The product instance ID.', example='pp-bp1ddg1n2a****'),
  requestId?: string(name='RequestId', description='The request ID.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model CreateProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateProvisionedProductPlanResponseBody(name='body'),
}

async function createProvisionedProductPlanWithOptions(request: CreateProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): CreateProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.operationType)) {
    body['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.parameters)) {
    body['Parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.planName)) {
    body['PlanName'] = request.planName;
  }
  if (!Util.isUnset(request.planType)) {
    body['PlanType'] = request.planType;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  if (!Util.isUnset(request.provisionedProductName)) {
    body['ProvisionedProductName'] = request.provisionedProductName;
  }
  if (!Util.isUnset(request.stackRegionId)) {
    body['StackRegionId'] = request.stackRegionId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createProvisionedProductPlan(request: CreateProvisionedProductPlanRequest): CreateProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return createProvisionedProductPlanWithOptions(request, runtime);
}

model CreateTagOptionRequest {
  key?: string(name='Key', description='The key of the tag option.

The key can be up to 128 characters in length. It cannot start with `aliyun` or `acs:` and cannot contain `http://` or `https://`.', example='k1'),
  value?: string(name='Value', description='The value of the tag option.

The value can be up to 128 characters in length. It cannot start with `acs:`and cannot contain `http://` or `https://`.', example='v1'),
}

model CreateTagOptionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='A48A5F12-6098-54A1-A389-6834AF27****'),
  tagOptionDetail?: {
    active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

*   true (default)
*   false', example='true'),
    key?: string(name='Key', description='The key of the tag option.

The key must be 1 to 128 characters in length. It cannot start with `aliyun` or `acs:` and cannot contain `http://` or `https://`.', example='k1'),
    owner?: string(name='Owner', description='The ID of the Alibaba Cloud account to which the tag option belongs.', example='133413081827****'),
    tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1r3mxq3t****'),
    value?: string(name='Value', description='The value of the tag option.

The value must be 1 to 128 characters in length. It cannot start with `acs:` and cannot contain `http://` or `https://`.', example='v1'),
  }(name='TagOptionDetail', description='An array that consists of the details of the tag option.'),
}

model CreateTagOptionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTagOptionResponseBody(name='body'),
}

async function createTagOptionWithOptions(request: CreateTagOptionRequest, runtime: Util.RuntimeOptions): CreateTagOptionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.key)) {
    body['Key'] = request.key;
  }
  if (!Util.isUnset(request.value)) {
    body['Value'] = request.value;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTagOption',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTagOption(request: CreateTagOptionRequest): CreateTagOptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTagOptionWithOptions(request, runtime);
}

model CreateTemplateRequest {
  templateBody?: string(name='TemplateBody', description='The content of the template.

For more information about the template syntax, see [Structure of Terraform templates](~~184397~~).', example='{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Transform": "Aliyun::Terraform-v1.1",
  "Workspace": {
    "main.tf": "variable  \\"name\\" {  default = \\"auto_provisioning_group\\"}"
  },
  "Outputs": {}
}'),
  templateType?: string(name='TemplateType', description='The type of the template.

Set the value to RosTerraformTemplate, which specifies the Terraform template that is supported by Resource Orchestration Service (ROS).', example='RosTerraformTemplate'),
  terraformVariables?: [ 
    {
      description?: string(name='Description', description='The description of the variable.

For more information about the format of variable descriptions, see [Methods and suggestions for Terraform code development](~~322216~~).', example='{ "Label": { "en": "Instance Type" }, "AllowedValues": \\[ "ecs.s6-c1m1.small", "ecs.s6-c1m2.large", "ecs.s6-c1m2.xlarge" ] }'),
      variableName?: string(name='VariableName', description='The name of the variable.', example='instance_type'),
    }
  ](name='TerraformVariables', description='The variable settings of the Terraform template. You can configure the variables in a structured manner. Service Catalog applies the variable settings to the template.

> The variables must be defined in the Terraform template.'),
}

model CreateTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  templateUrl?: string(name='TemplateUrl', description='The URL of the template.', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
}

model CreateTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTemplateResponseBody(name='body'),
}

async function createTemplateWithOptions(request: CreateTemplateRequest, runtime: Util.RuntimeOptions): CreateTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.templateBody)) {
    body['TemplateBody'] = request.templateBody;
  }
  if (!Util.isUnset(request.templateType)) {
    body['TemplateType'] = request.templateType;
  }
  if (!Util.isUnset(request.terraformVariables)) {
    body['TerraformVariables'] = request.terraformVariables;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTemplate',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTemplate(request: CreateTemplateRequest): CreateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTemplateWithOptions(request, runtime);
}

model DeleteConstraintRequest {
  constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
}

model DeleteConstraintResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DeleteConstraintResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteConstraintResponseBody(name='body'),
}

async function deleteConstraintWithOptions(request: DeleteConstraintRequest, runtime: Util.RuntimeOptions): DeleteConstraintResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.constraintId)) {
    body['ConstraintId'] = request.constraintId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteConstraint',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteConstraint(request: DeleteConstraintRequest): DeleteConstraintResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteConstraintWithOptions(request, runtime);
}

model DeletePortfolioRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
}

model DeletePortfolioResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DeletePortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePortfolioResponseBody(name='body'),
}

async function deletePortfolioWithOptions(request: DeletePortfolioRequest, runtime: Util.RuntimeOptions): DeletePortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeletePortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePortfolio(request: DeletePortfolioRequest): DeletePortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePortfolioWithOptions(request, runtime);
}

model DeleteProductRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model DeleteProductResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DeleteProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteProductResponseBody(name='body'),
}

async function deleteProductWithOptions(request: DeleteProductRequest, runtime: Util.RuntimeOptions): DeleteProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteProduct(request: DeleteProductRequest): DeleteProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteProductWithOptions(request, runtime);
}

model DeleteProductVersionRequest {
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
}

model DeleteProductVersionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DeleteProductVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteProductVersionResponseBody(name='body'),
}

async function deleteProductVersionWithOptions(request: DeleteProductVersionRequest, runtime: Util.RuntimeOptions): DeleteProductVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteProductVersion',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteProductVersion(request: DeleteProductVersionRequest): DeleteProductVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteProductVersionWithOptions(request, runtime);
}

model DeleteProvisionedProductPlanRequest {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
}

model DeleteProvisionedProductPlanResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DeleteProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteProvisionedProductPlanResponseBody(name='body'),
}

async function deleteProvisionedProductPlanWithOptions(request: DeleteProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): DeleteProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteProvisionedProductPlan(request: DeleteProvisionedProductPlanRequest): DeleteProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteProvisionedProductPlanWithOptions(request, runtime);
}

model DeleteTagOptionRequest {
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
}

model DeleteTagOptionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
}

model DeleteTagOptionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTagOptionResponseBody(name='body'),
}

async function deleteTagOptionWithOptions(request: DeleteTagOptionRequest, runtime: Util.RuntimeOptions): DeleteTagOptionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.tagOptionId)) {
    body['TagOptionId'] = request.tagOptionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTagOption',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteTagOption(request: DeleteTagOptionRequest): DeleteTagOptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTagOptionWithOptions(request, runtime);
}

model DisAssociateTagOptionFromResourceRequest {
  resourceId?: string(name='ResourceId', description='The ID of the resource with which the tag option is associated.', example='prod-bp14katy3d****'),
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
}

model DisAssociateTagOptionFromResourceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='7E23D1F3-4333-587B-909C-39EA4626****'),
}

model DisAssociateTagOptionFromResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisAssociateTagOptionFromResourceResponseBody(name='body'),
}

async function disAssociateTagOptionFromResourceWithOptions(request: DisAssociateTagOptionFromResourceRequest, runtime: Util.RuntimeOptions): DisAssociateTagOptionFromResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.tagOptionId)) {
    body['TagOptionId'] = request.tagOptionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisAssociateTagOptionFromResource',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disAssociateTagOptionFromResource(request: DisAssociateTagOptionFromResourceRequest): DisAssociateTagOptionFromResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return disAssociateTagOptionFromResourceWithOptions(request, runtime);
}

model DisassociatePrincipalFromPortfolioRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
  principalId?: string(name='PrincipalId', description='The ID of the RAM entity.

For more information about how to obtain the ID of a RAM user, see [GetUser](~~28681~~).

For more information about how to obtain the ID of a RAM role, see [GetRole](~~28711~~).', example='24477111603637****'),
  principalType?: string(name='PrincipalType', description='The type of the Resource Access Management (RAM) entity. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
}

model DisassociatePrincipalFromPortfolioResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DisassociatePrincipalFromPortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisassociatePrincipalFromPortfolioResponseBody(name='body'),
}

async function disassociatePrincipalFromPortfolioWithOptions(request: DisassociatePrincipalFromPortfolioRequest, runtime: Util.RuntimeOptions): DisassociatePrincipalFromPortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.principalId)) {
    body['PrincipalId'] = request.principalId;
  }
  if (!Util.isUnset(request.principalType)) {
    body['PrincipalType'] = request.principalType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisassociatePrincipalFromPortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disassociatePrincipalFromPortfolio(request: DisassociatePrincipalFromPortfolioRequest): DisassociatePrincipalFromPortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return disassociatePrincipalFromPortfolioWithOptions(request, runtime);
}

model DisassociateProductFromPortfolioRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model DisassociateProductFromPortfolioResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model DisassociateProductFromPortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisassociateProductFromPortfolioResponseBody(name='body'),
}

async function disassociateProductFromPortfolioWithOptions(request: DisassociateProductFromPortfolioRequest, runtime: Util.RuntimeOptions): DisassociateProductFromPortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisassociateProductFromPortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disassociateProductFromPortfolio(request: DisassociateProductFromPortfolioRequest): DisassociateProductFromPortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return disassociateProductFromPortfolioWithOptions(request, runtime);
}

model ExecuteProvisionedProductPlanRequest {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
}

model ExecuteProvisionedProductPlanResponseBody = {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ExecuteProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ExecuteProvisionedProductPlanResponseBody(name='body'),
}

async function executeProvisionedProductPlanWithOptions(request: ExecuteProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): ExecuteProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function executeProvisionedProductPlan(request: ExecuteProvisionedProductPlanRequest): ExecuteProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeProvisionedProductPlanWithOptions(request, runtime);
}

model GetConstraintRequest {
  constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
}

model GetConstraintResponseBody = {
  constraintDetail?: {
    config?: string(name='Config', description='The configuration of the constraint.

Format: { "LocalRoleName": "\\<role_name>" }.', example='{ "LocalRoleName": "TestRole" }'),
    constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
    constraintType?: string(name='ConstraintType', description='The type of the constraint.

The value is fixed as Launch, which indicates the launch constraint.', example='Launch'),
    createTime?: string(name='CreateTime', description='The time when the constraint was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:11:26Z'),
    description?: string(name='Description', description='The description of the constraint.', example='Launch as local role TestRole'),
    portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio to which the constraint belongs.', example='port-bp1yt7582g****'),
    productId?: string(name='ProductId', description='The ID of the product for which the constraint is created.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance.'),
  }(name='ConstraintDetail', description='The details of the constraint.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model GetConstraintResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetConstraintResponseBody(name='body'),
}

async function getConstraintWithOptions(request: GetConstraintRequest, runtime: Util.RuntimeOptions): GetConstraintResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.constraintId)) {
    query['ConstraintId'] = request.constraintId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConstraint',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getConstraint(request: GetConstraintRequest): GetConstraintResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConstraintWithOptions(request, runtime);
}

model GetPortfolioRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
}

model GetPortfolioResponseBody = {
  portfolioDetail?: {
    createTime?: string(name='CreateTime', description='The time when the product portfolio was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:11:12Z'),
    description?: string(name='Description', description='The description of the product portfolio.', example='The description of the product portfolio.'),
    portfolioArn?: string(name='PortfolioArn', description='The Alibaba Cloud Resource Name (ARN) of the product portfolio.', example='acs:servicecatalog:cn-hangzhou:146611588617****:portfolio/port-bp1yt7582g****'),
    portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
    portfolioName?: string(name='PortfolioName', description='The name of the product portfolio.', example='DEMO-IT services'),
    providerName?: string(name='ProviderName', description='The provider of the product portfolio.', example='IT team'),
  }(name='PortfolioDetail', description='The details of the product portfolio.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  tagOptions?: [ 
    {
      active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

- true (default)
- false', example='true'),
      key?: string(name='Key', description='The key of the tag option.', example='k1'),
      owner?: string(name='Owner', description='The ID of the owner of the tag option.', example='133413081827****'),
      tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1q65xd3j****'),
      value?: string(name='Value', description='The value of the tag option.', example='v1'),
    }
  ](name='TagOptions', description='The tag options associated with the service portfolio.'),
}

model GetPortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPortfolioResponseBody(name='body'),
}

async function getPortfolioWithOptions(request: GetPortfolioRequest, runtime: Util.RuntimeOptions): GetPortfolioResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.portfolioId)) {
    query['PortfolioId'] = request.portfolioId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPortfolio(request: GetPortfolioRequest): GetPortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPortfolioWithOptions(request, runtime);
}

model GetProductAsAdminRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model GetProductAsAdminResponseBody = {
  productDetail?: {
    createTime?: string(name='CreateTime', description='The creation time.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
    description?: string(name='Description', description='The description of the product.', example='This is a product description.'),
    productArn?: string(name='ProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
    productType?: string(name='ProductType', description='The type of the product.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
    providerName?: string(name='ProviderName', description='The provider of the product.', example='IT team'),
  }(name='ProductDetail', description='The information about the product.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  tagOptions?: [ 
    {
      active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

- true (default)
- false', example='true'),
      key?: string(name='Key', description='The key of the tag option.', example='k1'),
      owner?: string(name='Owner', description='The ID of the owner of the tag option.', example='133413081827****'),
      tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1q65xd3j****'),
      value?: string(name='Value', description='The value of the tag option.', example='v1'),
    }
  ](name='TagOptions', description='The tag options associated with the product.'),
}

model GetProductAsAdminResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProductAsAdminResponseBody(name='body'),
}

async function getProductAsAdminWithOptions(request: GetProductAsAdminRequest, runtime: Util.RuntimeOptions): GetProductAsAdminResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProductAsAdmin',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProductAsAdmin(request: GetProductAsAdminRequest): GetProductAsAdminResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProductAsAdminWithOptions(request, runtime);
}

model GetProductAsEndUserRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model GetProductAsEndUserResponseBody = {
  productSummary?: {
    createTime?: string(name='CreateTime', description='The time when the product was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
    description?: string(name='Description', description='The description of the product.', example='The description of the product.'),
    hasDefaultLaunchOption?: boolean(name='HasDefaultLaunchOption', description='Indicates whether the default launch option exists. Valid values:

*   true: The default launch option exists. In this case, the PortfolioId parameter is not required when the product is launched or when the information about the product instance is updated.
*   false: The default launch option does not exist. In this case, the PortfolioId parameter is required when the product is launched or when the information about the product instance is updated. For more information about how to obtain the value of the PortfolioId parameter, see [ListLaunchOptions](~~ListLaunchOptions~~).

> If the product is added to only one product portfolio, the default launch option exists. If the product is added to multiple product portfolios, multiple launch options exist at the same time. However, no default launch options exist.', example='true'),
    productArn?: string(name='ProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance.'),
    productType?: string(name='ProductType', description='The type of the product.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
    providerName?: string(name='ProviderName', description='The provider of the product.', example='IT team'),
  }(name='ProductSummary', description='The information about the product.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model GetProductAsEndUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProductAsEndUserResponseBody(name='body'),
}

/**
  * Make sure that you are granted the permissions to manage relevant products as a user by an administrator. For more information, see [Manage access permissions](~~405233~~).
  *
  * @param request GetProductAsEndUserRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetProductAsEndUserResponse
 */
async function getProductAsEndUserWithOptions(request: GetProductAsEndUserRequest, runtime: Util.RuntimeOptions): GetProductAsEndUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProductAsEndUser',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * Make sure that you are granted the permissions to manage relevant products as a user by an administrator. For more information, see [Manage access permissions](~~405233~~).
  *
  * @param request GetProductAsEndUserRequest
  * @return GetProductAsEndUserResponse
 */
async function getProductAsEndUser(request: GetProductAsEndUserRequest): GetProductAsEndUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProductAsEndUserWithOptions(request, runtime);
}

model GetProductVersionRequest {
  productVersionId?: string(name='ProductVersionId', example='pv-bp15e79d26****'),
}

model GetProductVersionResponseBody = {
  productVersionDetail?: {
    active?: boolean(name='Active', example='true'),
    createTime?: string(name='CreateTime', example='2022-04-12T06:10:37Z'),
    description?: string(name='Description'),
    guidance?: string(name='Guidance', example='Default'),
    productId?: string(name='ProductId', example='prod-bp18r7q127****'),
    productVersionId?: string(name='ProductVersionId', example='pv-bp15e79d26****'),
    productVersionName?: string(name='ProductVersionName', example='1.0'),
    templateType?: string(name='TemplateType', example='RosTerraformTemplate'),
    templateUrl?: string(name='TemplateUrl', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
  }(name='ProductVersionDetail'),
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model GetProductVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProductVersionResponseBody(name='body'),
}

async function getProductVersionWithOptions(request: GetProductVersionRequest, runtime: Util.RuntimeOptions): GetProductVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productVersionId)) {
    query['ProductVersionId'] = request.productVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProductVersion',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProductVersion(request: GetProductVersionRequest): GetProductVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProductVersionWithOptions(request, runtime);
}

model GetProvisionedProductRequest {
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
}

model GetProvisionedProductResponseBody = {
  provisionedProductDetail?: {
    createTime?: string(name='CreateTime', description='The time when the product instance was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:46:27Z'),
    lastProvisioningTaskId?: string(name='LastProvisioningTaskId', description='The ID of the task that was last run on the product instance.

The task can be one of the following types:

*   LaunchProduct: a task that launches the product.
*   UpdateProvisionedProduct: a task that updates the information about the product instance.
*   TerminateProvisionedProduct: a task that terminates the product instance.', example='task-bp1dmg242c****'),
    lastSuccessfulProvisioningTaskId?: string(name='LastSuccessfulProvisioningTaskId', description='The ID of the last task that was successfully run on the product instance.

The task can be one of the following types:

*   LaunchProduct: a task that launches the product.
*   UpdateProvisionedProduct: a task that updates the information about the product instance.
*   TerminateProvisionedProduct: a task that terminates the product instance.', example='task-bp1dmg242c****'),
    lastTaskId?: string(name='LastTaskId', description='The ID of the task that was last run.', example='task-bp1dmg242c****'),
    ownerPrincipalId?: string(name='OwnerPrincipalId', description='The ID of the RAM entity to which the product instance belongs.', example='24477111603637****'),
    ownerPrincipalType?: string(name='OwnerPrincipalType', description='The type of the Resource Access Management (RAM) entity to which the product instance belongs. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
    portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
    productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
    productVersionName?: string(name='ProductVersionName', description='The name of the product version.', example='1.0'),
    provisionedProductArn?: string(name='ProvisionedProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product instance.', example='acs:servicecatalog:cn-hangzhou:146611588617****:provisionedproduct/pp-bp1ddg1n2a****'),
    provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
    provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.', example='DEMO-ECS instance'),
    provisionedProductType?: string(name='ProvisionedProductType', description='The type of the product instance.

The value is fixed as RosStack, which indicates an ROS stack.', example='RosStack'),
    stackId?: string(name='StackId', description='The ID of the Resource Orchestration Service (ROS) stack.', example='137e31df-3754-40b4-be2f-c793ad84****'),
    stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the ROS stack belongs.', example='cn-hangzhou'),
    status?: string(name='Status', description='The state of the product instance. Valid values:

*   Available: The product instance was available.
*   UnderChange: The information about the product instance was being changed.
*   Error: An exception occurred on the product instance.', example='Available'),
    statusMessage?: string(name='StatusMessage', description='The message that is returned for the status of the product instance.

> This parameter is returned only when Error is returned for the Status parameter.', example='Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
  }(name='ProvisionedProductDetail', description='The details of the product instance.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model GetProvisionedProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProvisionedProductResponseBody(name='body'),
}

async function getProvisionedProductWithOptions(request: GetProvisionedProductRequest, runtime: Util.RuntimeOptions): GetProvisionedProductResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.provisionedProductId)) {
    query['ProvisionedProductId'] = request.provisionedProductId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProvisionedProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProvisionedProduct(request: GetProvisionedProductRequest): GetProvisionedProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProvisionedProductWithOptions(request, runtime);
}

model GetProvisionedProductPlanRequest {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
}

model GetProvisionedProductPlanResponseBody = {
  planDetail?: {
    approvalDetail?: {
      operationRecords?: [ 
        {
          approvalAction?: string(name='ApprovalAction', description='The operation that is performed by the operator on the plan. Valid values:

*   Submit: submits the plan.
*   Cancel: cancels the plan.
*   Approve: approves the plan.
*   reject: rejects the plan.', example='Approve'),
          comment?: string(name='Comment', description='The review comment of the operator.', example='Agreed.'),
          createTime?: string(name='CreateTime', description='The time when the operation was performed.', example='2022-03-22T05:56:14Z'),
          operator?: {
            principalId?: string(name='PrincipalId', description='The RAM entity ID of the operator.', example='277401963826235***'),
            principalName?: string(name='PrincipalName', description='The RAM entity name of the operator.', example='approver'),
            principalType?: string(name='PrincipalType', description='The RAM entity type of the operator. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
          }(name='Operator', description='The operator who performs operations on the plan.'),
        }
      ](name='OperationRecords', description='An array that consists of operations that are performed by the operator.'),
      todoTaskActivities?: [ 
        {
          activityName?: string(name='ActivityName', description='The name of the operation that is being performed by the plan.', example='ApproverNode-1'),
          tasks?: [ 
            {
              operator?: {
                principalName?: string(name='PrincipalName', description='The RAM entity name of the operator.', example='approver'),
                principalType?: string(name='PrincipalType', description='The RAM entity type of the operator. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
              }(name='Operator', description='The operator who performs operations on the plan.'),
            }
          ](name='Tasks', description='An array consisting of tasks that are pending for review.'),
        }
      ](name='TodoTaskActivities', description='An array that consists of operations that are being performed by the plan.'),
    }(name='ApprovalDetail', description='The review details of the plan.'),
    assignedApprovers?: [ 
      {
        principalName?: string(name='PrincipalName', description='The RAM entity name of the reviewer.', example='approver'),
        principalType?: string(name='PrincipalType', description='The type of the Resource Access Management (RAM) entity of the reviewer. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
      }
    ](name='AssignedApprovers', description='An array that consists of reviewers.'),
    createTime?: string(name='CreateTime', description='The time when the plan was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:46:27Z'),
    description?: string(name='Description', description='The description of the plan.', example='Create an ECS instance.'),
    operationType?: string(name='OperationType', description='The purpose of the plan. Valid values:

*   LaunchProduct: launches the product.
*   UpdateProvisionedProduct: updates the information about the product instance.
*   TerminateProvisionedProduct: terminates the product instance.', example='LaunchProduct'),
    ownerPrincipalId?: string(name='OwnerPrincipalId', description='The ID of the RAM entity to which the plan belongs.', example='27740196382623****'),
    ownerPrincipalName?: string(name='OwnerPrincipalName', description='The name of the RAM entity to which the plan belongs.', example='endUser'),
    ownerPrincipalType?: string(name='OwnerPrincipalType', description='The type of the RAM entity to which the plan belongs. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
    parameters?: [ 
      {
        parameterKey?: string(name='ParameterKey', description='The name of the parameter in the template.', example='instance_type'),
        parameterValue?: string(name='ParameterValue', description='The value of the parameter in the template.', example='ecs.s6-c1m1.small'),
      }
    ](name='Parameters', description='An array that consists of the parameters in the template.'),
    planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
    planName?: string(name='PlanName', description='The name of the plan.', example='DEMO-ECS instance'),
    planType?: string(name='PlanType', description='The type of the plan.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
    portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
    provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
    provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.', example='DEMO-ECS instance'),
    stackId?: string(name='StackId', description='The ID of the ROS stack.', example='137e31df-3754-40b4-be2f-c793ad84****'),
    stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the ROS stack belongs.', example='cn-hangzhou'),
    status?: string(name='Status', description='The state of the plan. Valid values:

*   PreviewInProgress: The plan is being prechecked.
*   PreviewSuccess: The precheck is successful.
*   PreviewFailed: The precheck fails.
*   ExecuteInProgress: The plan is being run.
*   ExecuteSuccess: The plan is run.
*   ExecuteFailed: The plan fails to be run.', example='PreviewSuccess'),
    statusMessage?: string(name='StatusMessage', description='The message returned for the state.

> This parameter is returned only when PreviewFailed or ExecuteFailed is returned for Status.', example='Create stack failed: Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
    tags?: [ 
      {
        key?: string(name='Key', description='The key of the custom tag.', example='k1'),
        value?: string(name='Value', description='The value of the custom tag.', example='v1'),
      }
    ](name='Tags', description='An array that consists of custom tags.'),
    uid?: string(name='Uid', description='The ID of the Alibaba Cloud account to which the plan belongs.', example='146611588617****'),
    updateTime?: string(name='UpdateTime', description='The last time when the task was modified.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:47:29Z'),
  }(name='PlanDetail', description='The details of the plan.'),
  productDetail?: {
    createTime?: string(name='CreateTime', description='The creation time.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
    description?: string(name='Description', description='The description of the product.', example='This is a product description.'),
    productArn?: string(name='ProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
    productType?: string(name='ProductType', description='The type of the product.

The value is fixed as Ros, which indicates ROS.', example='Ros'),
    providerName?: string(name='ProviderName', description='The provider of the product.', example='IT team'),
  }(name='ProductDetail', description='The details of the product.'),
  productVersionDetail?: {
    active?: boolean(name='Active', description='Indicates whether the product version is visible to end users. Valid values:

*   true (default)
*   false', example='true'),
    createTime?: string(name='CreateTime', description='The time when the product version was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
    description?: string(name='Description', description='The description of the product version.', example='The description of the product version.'),
    guidance?: string(name='Guidance', description='The recommendation information. Valid values:

*   Default: No recommendation information is provided. This is the default value.
*   Recommended: the recommendation version.
*   Latest: the latest version.
*   Deprecated: the version that is about to be deprecated.', example='Default'),
    productId?: string(name='ProductId', description='The ID of the product to which the product version belongs.', example='prod-bp18r7q127****'),
    productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
    productVersionName?: string(name='ProductVersionName', description='The name for the version of the product.', example='1.0.0'),
    templateType?: string(name='TemplateType', description='The type of the template.

The value is fixed as RosTerraformTemplate, which indicates that the Terraform template is supported by ROS.', example='RosTerraformTemplate'),
    templateUrl?: string(name='TemplateUrl', description='The URL of the template.', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
  }(name='ProductVersionDetail', description='The details of the product version.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  resourceChanges?: [ 
    {
      action?: string(name='Action', description='The action that is performed on the resource. Valid values:

*   Add
*   Modify
*   Remove
*   None', example='Add'),
      logicalResourceId?: string(name='LogicalResourceId', description='The logical ID of the resource.', example='instance'),
      physicalResourceId?: string(name='PhysicalResourceId', description='The physical ID of the resource.

> This parameter is returned only when Action is set to Modify or Remove.', example='i-bp13lmam3qd9q6il****'),
      replacement?: string(name='Replacement', description='Indicates whether a replacement update is performed on the template. Valid values:

*   True: A replacement update is performed on the template.
*   False: A change is made on the template.
*   Conditional: A replacement update may be performed on the template. You can check whether a replacement update is performed when the template is in use.

> This parameter is returned only when Action is set to Modify.', example='True'),
      resourceType?: string(name='ResourceType', description='The type of the resource.', example='alicloud_instance'),
    }
  ](name='ResourceChanges', description='An array that consists of the resources to be changed in the plan.'),
}

model GetProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetProvisionedProductPlanResponseBody(name='body'),
}

async function getProvisionedProductPlanWithOptions(request: GetProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): GetProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProvisionedProductPlan(request: GetProvisionedProductPlanRequest): GetProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return getProvisionedProductPlanWithOptions(request, runtime);
}

model GetTagOptionRequest {
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1r3mxq3t****'),
}

model GetTagOptionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C1509725-055D-5C7B-9420-8B737DBD****'),
  tagOptionDetail?: {
    active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

*   true
*   false', example='true'),
    key?: string(name='Key', description='The key of the tag option.', example='k1'),
    owner?: string(name='Owner', description='The ID of the Alibaba Cloud account to which the tag option belongs.', example='133413081827****'),
    tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp15qmwz3r****'),
    value?: string(name='Value', description='The value of the tag option.', example='v1'),
  }(name='TagOptionDetail', description='The details of the tag option.'),
}

model GetTagOptionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTagOptionResponseBody(name='body'),
}

async function getTagOptionWithOptions(request: GetTagOptionRequest, runtime: Util.RuntimeOptions): GetTagOptionResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTagOption',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTagOption(request: GetTagOptionRequest): GetTagOptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTagOptionWithOptions(request, runtime);
}

model GetTaskRequest {
  taskId?: string(name='TaskId', description='The ID of the task.', example='task-bp1dmg242c****'),
}

model GetTaskResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  taskDetail?: {
    createTime?: string(name='CreateTime', description='The time when the task was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:46:27Z'),
    log?: {
      terraformLogs?: [ 
        {
          command?: string(name='Command', description='The name of the Terraform command that is run. Valid values:

*   apply
*   plan
*   destroy
*   version

For more information about Terraform commands, see [Basic CLI Features](https://www.terraform.io/cli/commands).', example='apply'),
          content?: string(name='Content', description='The content of the output stream that is returned after the command is run.', example='Apply complete! Resources: 42 added, 0 changed, 0 destroyed.'),
          stream?: string(name='Stream', description='The output stream. Valid values:

*   stdout: a standard output stream
*   stderr: a standard error stream', example='stdout'),
        }
      ](name='TerraformLogs', description='The Terraform logs.'),
    }(name='Log', description='The logs of the instance.'),
    outputs?: [ 
      {
        description?: string(name='Description', description='The description of the output parameter for the template.', example='The ECS instance ID.'),
        outputKey?: string(name='OutputKey', description='The name of the output parameter for the template.', example='instance_id'),
        outputValue?: string(name='OutputValue', description='The value of the output parameter for the template.', example='i-xxxxxx'),
      }
    ](name='Outputs', description='The output parameters of the template.'),
    parameters?: [ 
      {
        parameterKey?: string(name='ParameterKey', description='The name of the input parameter for the template.', example='instance_type'),
        parameterValue?: string(name='ParameterValue', description='The value of the input parameter for the template.', example='ecs.s6-c1m1.small'),
      }
    ](name='Parameters', description='The parameters that are specified in the template.'),
    portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
    productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
    productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
    productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
    productVersionName?: string(name='ProductVersionName', description='The name of the product version.', example='1.0'),
    provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
    provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.', example='DEMO-ECS instance'),
    status?: string(name='Status', description='The state of the task. Valid values:

*   Succeeded: The task was successful.
*   InProgress: The task was in progress.
*   Failed: The task failed.', example='Succeeded'),
    statusMessage?: string(name='StatusMessage', description='The message that is returned for the status of the task.

> This parameter is returned only when Failed is returned for the Status parameter.', example='Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
    taskId?: string(name='TaskId', description='The ID of the task.', example='task-bp1dmg242c****'),
    taskTags?: [ 
      {
        key?: string(name='Key', description='The custom tag key.

The tag key can be up to 128 characters in length and cannot contain `http://` or `https://`. The tag key cannot start with `acs:` or `aliyun`.', example='k1'),
        value?: string(name='Value', description='The custom tag value.

The value must be 1 to 128 characters in length. It cannot start with `acs:` and cannot contain `http://` or `https://`.', example='v1'),
      }
    ](name='TaskTags', description='The custom tags.'),
    taskType?: string(name='TaskType', description='The type of the task. Valid values:

*   LaunchProduct: a task that launches the product.
*   UpdateProvisionedProduct: a task that updates the information about the product instance.
*   TerminateProvisionedProduct: a task that terminates the product instance.', example='LaunchProduct'),
    updateTime?: string(name='UpdateTime', description='The time when the task was last modified.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:47:29Z'),
  }(name='TaskDetail', description='The details of the task.'),
}

model GetTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTaskResponseBody(name='body'),
}

async function getTaskWithOptions(request: GetTaskRequest, runtime: Util.RuntimeOptions): GetTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTask',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTask(request: GetTaskRequest): GetTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTaskWithOptions(request, runtime);
}

model GetTemplateRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
}

model GetTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  templateBody?: string(name='TemplateBody', description='The content of the template.

For more information about the template syntax, see [Structure of Terraform templates](~~184397~~).', example='{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Transform": "Aliyun::Terraform-v1.1",
  "Workspace": {
    "main.tf": "variable  \\"name\\" {  default = \\"auto_provisioning_group\\"}"
  },
  "Outputs": {}
}'),
}

model GetTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTemplateResponseBody(name='body'),
}

async function getTemplateWithOptions(request: GetTemplateRequest, runtime: Util.RuntimeOptions): GetTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionId)) {
    query['ProductVersionId'] = request.productVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTemplate',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTemplate(request: GetTemplateRequest): GetTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTemplateWithOptions(request, runtime);
}

model LaunchProductRequest {
  parameters?: [ 
    {
      parameterKey?: string(name='ParameterKey', description='The name of the input parameter for the template.', example='instance_type'),
      parameterValue?: string(name='ParameterValue', description='The value of the input parameter for the template.', example='ecs.s6-c1m1.small'),
    }
  ](name='Parameters', description='The input parameters of the template.

You can specify up to 200 parameters.

> This parameter is optional. If you specify the Parameters parameter, you must specify the ParameterKey and ParameterValue parameters.'),
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.

> If the PortfolioId parameter is not required, you do not need to specify the PortfolioId parameter. If the PortfolioId parameter is required, you must specify the PortfolioId parameter. For more information about how to obtain the value of the PortfolioId parameter, see [ListLaunchOptions](~~ListLaunchOptions~~).', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.

The value must be 1 to 128 characters in length.', example='DEMO-ECS instance'),
  stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the Resource Orchestration Service (ROS) stack belongs.

For more information about how to obtain the regions that are supported by ROS, see [DescribeRegions](~~131035~~).', example='cn-hangzhou'),
  tags?: [ 
    {
      key?: string(name='Key', description='The tag key of the custom tag.

The tag key must be 1 to 128 characters in length and cannot contain `http://` or `https://`. It cannot start with `acs:` or `aliyun`.', example='k1'),
      value?: string(name='Value', description='The tag value of the custom tag.

The tag value can be up to 128 characters in length and cannot start with `acs:`. It cannot contain `http://` or `https://`.', example='v1'),
    }
  ](name='Tags', description='The custom tags that are specified by the end user.

Maximum value of N: 20.

> 

*   The Tags parameter is optional. If you specify the Tags parameter, you must specify the Tags.N.Key and Tags.N.Value parameters.

*   The tag is propagated to each stack resource that supports the tag feature.'),
}

model LaunchProductResponseBody = {
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the instance', example='pp-bp1ddg1n2a****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model LaunchProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: LaunchProductResponseBody(name='body'),
}

async function launchProductWithOptions(request: LaunchProductRequest, runtime: Util.RuntimeOptions): LaunchProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.parameters)) {
    body['Parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  if (!Util.isUnset(request.provisionedProductName)) {
    body['ProvisionedProductName'] = request.provisionedProductName;
  }
  if (!Util.isUnset(request.stackRegionId)) {
    body['StackRegionId'] = request.stackRegionId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'LaunchProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function launchProduct(request: LaunchProductRequest): LaunchProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return launchProductWithOptions(request, runtime);
}

model ListLaunchOptionsRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model ListLaunchOptionsResponseBody = {
  launchOptionSummaries?: [ 
    {
      constraintSummaries?: [ 
        {
          constraintType?: string(name='ConstraintType', description='The type of the constraint. Valid values:

1.  Launch
2.  Template
3.  Approval
4.  StackRegion', example='Launch'),
          description?: string(name='Description', description='The description of the constraint.', example='Launch as local role TestRole'),
          operationTypes?: [ string ](name='OperationTypes', description='The types of operations that require approval. If the type of the constraint is Approval, this parameter is not empty.'),
          stackRegions?: [ string ](name='StackRegions', description='The regions in which users can launch the service. If the type of the constraint is StackRegion, this parameter is not empty.'),
        }
      ](name='ConstraintSummaries', description='The constraints.'),
      portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
      portfolioName?: string(name='PortfolioName', description='The name of the product portfolio.', example='DEMO-IT services'),
    }
  ](name='LaunchOptionSummaries', description='The launch options.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ListLaunchOptionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLaunchOptionsResponseBody(name='body'),
}

async function listLaunchOptionsWithOptions(request: ListLaunchOptionsRequest, runtime: Util.RuntimeOptions): ListLaunchOptionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLaunchOptions',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLaunchOptions(request: ListLaunchOptionsRequest): ListLaunchOptionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLaunchOptionsWithOptions(request, runtime);
}

model ListPortfoliosRequest {
  filters?: [ 
    {
      key?: string(name='Key', example='PortfolioName'),
      value?: string(name='Value'),
    }
  ](name='Filters'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  productId?: string(name='ProductId', example='prod-bp18r7q127****'),
  scope?: string(name='Scope', example='Local'),
  sortBy?: string(name='SortBy', example='CreateTime'),
  sortOrder?: string(name='SortOrder', example='Desc'),
}

model ListPortfoliosResponseBody = {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  portfolioDetails?: [ 
    {
      createTime?: string(name='CreateTime', description='代表创建时间的资源属性字段', example='2022-04-12T06:11:12Z'),
      description?: string(name='Description', description='产品组合描述'),
      portfolioArn?: string(name='PortfolioArn', example='acs:servicecatalog:cn-hangzhou:146611588617****:portfolio/port-bp1yt7582g****'),
      portfolioId?: string(name='PortfolioId', description='代表资源一级ID的资源属性字段', example='port-bp1yt7582g****'),
      portfolioName?: string(name='PortfolioName', description='代表资源名称的资源属性字段'),
      providerName?: string(name='ProviderName', description='产品组合提供方'),
    }
  ](name='PortfolioDetails'),
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  totalCount?: int32(name='TotalCount', example='2'),
}

model ListPortfoliosResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPortfoliosResponseBody(name='body'),
}

async function listPortfoliosWithOptions(request: ListPortfoliosRequest, runtime: Util.RuntimeOptions): ListPortfoliosResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPortfolios',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPortfolios(request: ListPortfoliosRequest): ListPortfoliosResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPortfoliosWithOptions(request, runtime);
}

model ListPrincipalsRequest {
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
}

model ListPrincipalsResponseBody = {
  principals?: [ 
    {
      principalId?: string(name='PrincipalId', description='The ID of the RAM entity.', example='24477111603637****'),
      principalType?: string(name='PrincipalType', description='The type of the RAM entity. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
    }
  ](name='Principals', description='The RAM entities.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ListPrincipalsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPrincipalsResponseBody(name='body'),
}

async function listPrincipalsWithOptions(request: ListPrincipalsRequest, runtime: Util.RuntimeOptions): ListPrincipalsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.portfolioId)) {
    query['PortfolioId'] = request.portfolioId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPrincipals',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPrincipals(request: ListPrincipalsRequest): ListPrincipalsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPrincipalsWithOptions(request, runtime);
}

model ListProductVersionsRequest {
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
}

model ListProductVersionsResponseBody = {
  productVersionDetails?: [ 
    {
      active?: boolean(name='Active', description='Indicates whether the product version is enabled. Valid values:

true: The product version is enabled. This is the default value. false: The product version is disabled.', example='true'),
      createTime?: string(name='CreateTime', description='The time when the product version was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
      description?: string(name='Description', description='The description of the product version.', example='The description of the product version.'),
      guidance?: string(name='Guidance', description='The recommendation information. Valid values:

*   Default: No recommendation information is provided. This is the default value.
*   Recommended: the recommended version.
*   Latest: the latest version.
*   Deprecated: the version that is about to be discontinued.', example='Default'),
      productId?: string(name='ProductId', description='The ID of the product to which the product version belongs.', example='prod-bp18r7q127****'),
      productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
      productVersionName?: string(name='ProductVersionName', description='The name of the product version.', example='1.0'),
      templateType?: string(name='TemplateType', description='The type of the template.

The value is fixed as RosTerraformTemplate, which indicates the Terraform template that is supported by Resource Orchestration Service (ROS).', example='RosTerraformTemplate'),
      templateUrl?: string(name='TemplateUrl', description='The URL of the template.', example='oss://servicecatalog-cn-hangzhou/146611588617****/terraform/template/tpl-bp1217we23****/template.json'),
    }
  ](name='ProductVersionDetails', description='The versions of the product.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ListProductVersionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProductVersionsResponseBody(name='body'),
}

async function listProductVersionsWithOptions(request: ListProductVersionsRequest, runtime: Util.RuntimeOptions): ListProductVersionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.productId)) {
    query['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProductVersions',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProductVersions(request: ListProductVersionsRequest): ListProductVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProductVersionsWithOptions(request, runtime);
}

model ListProductsAsAdminRequest {
  filters?: [ 
    {
      key?: string(name='Key', description='The name of the filter condition. Valid values:

*   ProductName: performs exact matches by product name. Product names are not case-sensitive.
*   FullTextSearch: performs full-text searches by product name, product provider, or product description. Fuzzy match is supported.', example='ProductName'),
      value?: string(name='Value', description='The value of the filter condition.', example='DEMO-Create an ECS instance'),
    }
  ](name='Filters', description='The filter conditions.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
  scope?: string(name='Scope', description='The query scope. Valid values:

*   Local: the products that are created by using the current account. This is the default value.
*   Import: the products that are imported from other accounts.
*   All: all available products.', example='Local'),
  sortBy?: string(name='SortBy', description='The field that is used to sort the queried data.

Set the value to CreateTime, which specifies the time when the product was created.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The order in which you want to sort the queried data. Valid values:

*   Asc: the ascending order
*   Desc: the descending order', example='Desc'),
}

model ListProductsAsAdminResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  productDetails?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the product was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
      description?: string(name='Description', description='The description of the product.', example='The description of the product.'),
      productArn?: string(name='ProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
      productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
      productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
      productType?: string(name='ProductType', description='The type of the product.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
      providerName?: string(name='ProviderName', description='The provider of the product.', example='IT team'),
    }
  ](name='ProductDetails', description='The products.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListProductsAsAdminResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProductsAsAdminResponseBody(name='body'),
}

async function listProductsAsAdminWithOptions(request: ListProductsAsAdminRequest, runtime: Util.RuntimeOptions): ListProductsAsAdminResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.portfolioId)) {
    query['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProductsAsAdmin',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProductsAsAdmin(request: ListProductsAsAdminRequest): ListProductsAsAdminResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProductsAsAdminWithOptions(request, runtime);
}

model ListProductsAsEndUserRequest {
  filters?: [ 
    {
      key?: string(name='Key', description='The name of the filter condition. Valid values:

*   ProductName: performs exact matches by product name. Product names are not case-sensitive.
*   FullTextSearch: performs full-text searches by product name, product provider, or product description. Fuzzy match is supported.', example='ProductName'),
      value?: string(name='Value', description='The value of the filter condition.', example='DEMO-Create an ECS instance'),
    }
  ](name='Filters', description='The filter conditions.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  sortBy?: string(name='SortBy', description='The field that is used to sort the queried data.

Set the value to CreateTime, which specifies the time when the product was created.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The order in which you want to sort the queried data. Valid values:

*   Asc: the ascending order
*   Desc: the descending order', example='Desc'),
}

model ListProductsAsEndUserResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  productSummaries?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the product was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-04-12T06:10:37Z'),
      description?: string(name='Description', description='The description of the product.', example='The description of the product.'),
      hasDefaultLaunchOption?: boolean(name='HasDefaultLaunchOption', description='Indicates whether the default launch option exists. Valid values:

*   true: The default launch option exists. In this case, the PortfolioId parameter is not required when the product is launched or when the information about the product instance is updated.
*   false: The default launch option does not exist. In this case, the PortfolioId parameter is required when the product is launched or when the information about the product instance is updated. For more information about how to obtain the value of the PortfolioId parameter, see [ListLaunchOptions](~~ListLaunchOptions~~).

> If the product is added to only one product portfolio, the default launch option exists. If the product is added to multiple product portfolios, multiple launch options exist at the same time. However, no default launch options exist.', example='true'),
      productArn?: string(name='ProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
      productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
      productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
      productType?: string(name='ProductType', description='The type of the product.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
      providerName?: string(name='ProviderName', description='The provider of the product.', example='IT team'),
    }
  ](name='ProductSummaries', description='The products.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='100'),
}

model ListProductsAsEndUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProductsAsEndUserResponseBody(name='body'),
}

/**
  * Make sure that you are granted the permissions to manage relevant products as a user by an administrator. For more information, see [Manage access permissions](~~405233~~).
  *
  * @param request ListProductsAsEndUserRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListProductsAsEndUserResponse
 */
async function listProductsAsEndUserWithOptions(request: ListProductsAsEndUserRequest, runtime: Util.RuntimeOptions): ListProductsAsEndUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProductsAsEndUser',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * Make sure that you are granted the permissions to manage relevant products as a user by an administrator. For more information, see [Manage access permissions](~~405233~~).
  *
  * @param request ListProductsAsEndUserRequest
  * @return ListProductsAsEndUserResponse
 */
async function listProductsAsEndUser(request: ListProductsAsEndUserRequest): ListProductsAsEndUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProductsAsEndUserWithOptions(request, runtime);
}

model ListProvisionedProductPlanApproversRequest {
  accessLevelFilter?: string(name='AccessLevelFilter', description='The access filter. Valid values:

*   User (default): queries the plans that are created by the current requester.
*   Account: queries the plans that belong to the current Alibaba Cloud account.
*   ResourceDirectory: queries the plans that belong to the current resource directory.

>  You must specify one of the `ApprovalFilter` and `AccessLevelFilter` parameters, but not both.', example='User'),
  approvalFilter?: string(name='ApprovalFilter', description='The access filter of the review dimension. Valid values:

*   AccountRequests: queries all reviewed plans that belong to the current Alibaba Cloud account.
*   ResourceDirectoryRequests: queries all plans that belong to the current resource directory.

>  You must specify one of the `ApprovalFilter` and `AccessLevelFilter` parameters, but not both.', example='AccountRequests'),
  filters?: [ 
    {
      key?: string(name='Key', description='The name of the filter condition. Valid values:

*   ProvisionedProductPlanApproverName: performs fuzzy match by reviewer name.', example='ProvisionedProductPlanApproverName'),
      value?: string(name='Value', description='The value of the filter condition.', example='approver'),
    }
  ](name='Filters', description='An array that consists of filter conditions.'),
}

model ListProvisionedProductPlanApproversResponseBody = {
  approvers?: [ 
    {
      principalName?: string(name='PrincipalName', description='The name of the reviewer.', example='approver-1'),
      principalType?: string(name='PrincipalType', description='The type of the Resource Access Management (RAM) entity of the reviewer. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
    }
  ](name='Approvers', description='An array that consists of reviewers.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
}

model ListProvisionedProductPlanApproversResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProvisionedProductPlanApproversResponseBody(name='body'),
}

async function listProvisionedProductPlanApproversWithOptions(request: ListProvisionedProductPlanApproversRequest, runtime: Util.RuntimeOptions): ListProvisionedProductPlanApproversResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProvisionedProductPlanApprovers',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProvisionedProductPlanApprovers(request: ListProvisionedProductPlanApproversRequest): ListProvisionedProductPlanApproversResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProvisionedProductPlanApproversWithOptions(request, runtime);
}

model ListProvisionedProductPlansRequest {
  accessLevelFilter?: string(name='AccessLevelFilter', description='The access filter. Valid values:

*   User (default): queries the plans that are created by the current requester.
*   Account: queries the plans that belong to the current Alibaba Cloud account.
*   ResourceDirectory: queries the plans that belong to the current resource directory.', example='User'),
  approvalFilter?: string(name='ApprovalFilter', description='The access filter of the review dimension. Valid values:

*   ReceivedRequests: queries plans that are pending for review.
*   ApprovalHistory: queries review history.
*   AccountRequests: queries all plans that belong to the current Alibaba Cloud account.
*   AccountRequests: queries all plans that belong to the current Alibaba Cloud account.', example='ReceivedRequests'),
  filters?: [ 
    {
      key?: string(name='Key', description='The name of the filter condition. Valid values:

*   ProvisionedProductPlanName: performs exact matches by plan name. Plan names are not case-sensitive.
*   ProvisionedProductPlanApprover: performs exact matches by reviewer. You must specify a reviewer in the `RamUser/RamRole:<Name of the reviewer>` format. You can specify multiple reviewers.
*   ProvisionedProductPlanApproverName: performs matches by reviewer name. You must specify the Resource Access Management (RAM) entity name of the reviewer. You can specify multiple reviewer names.
*   ProvisionedProductPlanStatus: performs matches by plan status. You must specify the state of the plan. You can specify multiple states.
*   ProvisionedProductPlanOwnerUid: performs exact matches by ID of Alibaba Cloud account to which a plan belongs.
*   FullTextSearch: performs fuzzy full-text searches by plan name.', example='FullTextSearch'),
      value?: string(name='Value', description='The value of the filter condition.', example='ECS'),
    }
  ](name='Filters', description='An array that consists of filter conditions.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Minimum value: 1. Default value: 10.', example='10'),
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
  sortBy?: string(name='SortBy', description='The information based on which you want to sort the query results.

Set the value to CreateTime, which specifies the creation time of plans.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The order in which you want to sort the query results. Valid values:

*   Asc: the ascending order
*   Desc (default): the descending order.', example='Desc'),
}

model ListProvisionedProductPlansResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.

Valid values: 1 to 100. Minimum value: 1. Default value: 10.', example='10'),
  planDetails?: [ 
    {
      assignedApprovers?: [ 
        {
          principalName?: string(name='PrincipalName', description='The RAM entity name of the reviewer.', example='endUser'),
          principalType?: string(name='PrincipalType', description='The type of the RAM entity of the reviewer. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
        }
      ](name='AssignedApprovers', description='An array that consists of reviewers.'),
      createTime?: string(name='CreateTime', description='The time when the plan was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-09-13T02:01:22Z'),
      description?: string(name='Description', description='The description of the plan.', example='For development team.'),
      operationType?: string(name='OperationType', description='The purpose of the plan. Valid values:

*   LaunchProduct: launches the product. This is the default value.
*   UpdateProvisionedProduct: updates the information about the product instance.
*   TerminateProvisionedProduct: terminates the product instance.', example='LaunchProduct'),
      ownerPrincipalId?: string(name='OwnerPrincipalId', description='The ID of the RAM entity to which the plan belongs.', example='24477111603637****'),
      ownerPrincipalName?: string(name='OwnerPrincipalName', description='The name of the RAM entity to which the plan belongs.', example='enduser'),
      ownerPrincipalType?: string(name='OwnerPrincipalType', description='The type of the RAM entity to which the plan belongs. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
      parameters?: [ 
        {
          parameterKey?: string(name='ParameterKey', description='The name of the parameter in the template.', example='role_name'),
          parameterValue?: string(name='ParameterValue', description='The value of the parameter in the template.', example='Test-8'),
        }
      ](name='Parameters', description='An array that consists of the parameters in the template.'),
      planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp18mmdh2u****'),
      planName?: string(name='PlanName', description='The name of the plan.', example='DEMO-Create an ECS instance-637\\*\\*\\*\\*'),
      planType?: string(name='PlanType', description='The type of the plan.

The value is fixed as Ros, which indicates Resource Orchestration Service (ROS).', example='Ros'),
      portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1438kf2j****'),
      productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp1rtrnh2c****'),
      productName?: string(name='ProductName', description='The name of the product.', example='Create an ECS instance'),
      productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp19udk22v****'),
      provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1c35162d****'),
      provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.', example='rds-MYSQL-875****'),
      stackId?: string(name='StackId', description='The ID of the ROS stack.', example='2599090a-309e-4306-b989-17ba66a9****'),
      stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the ROS stack belongs.', example='cn-hangzhou'),
      status?: string(name='Status', description='The state of the plan. Valid values:

*   PreviewInProgress: The plan is being prechecked.
*   PreviewSuccess: The precheck is successful.
*   PreviewFailed: The precheck fails.
*   ApplicationInProgress: The plan is being reviewed.
*   ApplicationApproved: The plan is approved.
*   ApplicationRejected: The approval is rejected.
*   ExecuteInProgress: The plan is being run.
*   ExecuteSuccess: The plan is run.
*   ExecuteFailed: The plan fails to be run.
*   Canceled: The plan is canceled.', example='PreviewSuccess'),
      statusMessage?: string(name='StatusMessage', description='The message returned for the state.

> This parameter is returned only when PreviewFailed or ExecuteFailed is returned for the Status parameter.', example='Create stack failed: Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
      tags?: [ 
        {
          key?: string(name='Key', description='The key of the custom tag.', example='k1'),
          value?: string(name='Value', description='The value of the custom tag.', example='v1'),
        }
      ](name='Tags', description='An array that consists of custom tags.'),
      uid?: string(name='Uid', description='The ID of the Alibaba Cloud account to which the plan belongs.', example='146611588617****'),
      updateTime?: string(name='UpdateTime', description='The last time when the task was modified.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-07-18T06:02:35.075Z'),
    }
  ](name='PlanDetails', description='An array that consists of plans.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='16'),
}

model ListProvisionedProductPlansResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProvisionedProductPlansResponseBody(name='body'),
}

async function listProvisionedProductPlansWithOptions(request: ListProvisionedProductPlansRequest, runtime: Util.RuntimeOptions): ListProvisionedProductPlansResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessLevelFilter)) {
    query['AccessLevelFilter'] = request.accessLevelFilter;
  }
  if (!Util.isUnset(request.approvalFilter)) {
    query['ApprovalFilter'] = request.approvalFilter;
  }
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.provisionedProductId)) {
    query['ProvisionedProductId'] = request.provisionedProductId;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProvisionedProductPlans',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProvisionedProductPlans(request: ListProvisionedProductPlansRequest): ListProvisionedProductPlansResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProvisionedProductPlansWithOptions(request, runtime);
}

model ListProvisionedProductsRequest {
  accessLevelFilter?: string(name='AccessLevelFilter', description='The access filter. Valid values:

*   User: queries the product instances that are created by the current requester. This is the default value.
*   Account: queries the product instances that belong to the current Alibaba Cloud account.', example='User'),
  filters?: [ 
    {
      key?: string(name='Key', description='The name of the filter condition. Valid values:

*   ProvisionedProductName: performs exact matches by product instance name. Product instance names are not case-sensitive.
*   FullTextSearch: performs full-text searches by product instance name. Fuzzy match is supported.', example='ProvisionedProductName'),
      value?: string(name='Value', description='The value of the filter condition.', example='DEMO-ECS instance'),
    }
  ](name='Filters', description='The filter conditions.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  sortBy?: string(name='SortBy', description='The field that is used to sort the queried data.

Set the value to CreateTime, which specifies the time when the product instance was created.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The sorting method. Valid values:

*   Asc: the ascending order.
*   Desc (default): the descending order.', example='Desc'),
}

model ListProvisionedProductsResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  provisionedProductDetails?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the product instance was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-05-23T09:46:27Z'),
      lastProvisioningTaskId?: string(name='LastProvisioningTaskId', description='The ID of the task that was last run on the product instance.

The task can be one of the following types:

*   LaunchProduct: a task that launches the product.
*   UpdateProvisionedProduct: a task that updates the information about the product instance.
*   TerminateProvisionedProduct: a task that terminates the product instance.', example='task-bp1dmg242c****'),
      lastSuccessfulProvisioningTaskId?: string(name='LastSuccessfulProvisioningTaskId', description='The ID of the last task that was successfully run on the product instance.

The task can be one of the following types:

*   LaunchProduct: a task that launches the product.
*   UpdateProvisionedProduct: a task that updates the information about the product instance.
*   TerminateProvisionedProduct: a task that terminates the product instance.', example='task-bp1dmg242c****'),
      lastTaskId?: string(name='LastTaskId', description='The ID of the task that was last run.', example='task-bp1dmg242c****'),
      ownerPrincipalId?: string(name='OwnerPrincipalId', description='The ID of the RAM entity to which the product instance belongs.', example='24477111603637****'),
      ownerPrincipalType?: string(name='OwnerPrincipalType', description='The type of the Resource Access Management (RAM) entity to which the product instance belongs. Valid values:

*   RamUser: a RAM user
*   RamRole: a RAM role', example='RamUser'),
      portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.', example='port-bp1yt7582g****'),
      productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
      productName?: string(name='ProductName', description='The name of the product.', example='DEMO-Create an ECS instance'),
      productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
      productVersionName?: string(name='ProductVersionName', description='The name of the product version.', example='1.0'),
      provisionedProductArn?: string(name='ProvisionedProductArn', description='The Alibaba Cloud Resource Name (ARN) of the product instance.', example='acs:servicecatalog:cn-hangzhou:146611588617****:provisionedproduct/pp-bp1ddg1n2a****'),
      provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
      provisionedProductName?: string(name='ProvisionedProductName', description='The name of the product instance.', example='DEMO-ECS instance'),
      provisionedProductType?: string(name='ProvisionedProductType', description='The type of the product instance.

The value is fixed as RosStack, which indicates an ROS stack.', example='RosStack'),
      stackId?: string(name='StackId', description='The ID of the Resource Orchestration Service (ROS) stack.', example='137e31df-3754-40b4-be2f-c793ad84****'),
      stackRegionId?: string(name='StackRegionId', description='The ID of the region to which the ROS stack belongs.', example='cn-hangzhou'),
      status?: string(name='Status', description='The state of the product instance. Valid values:

*   Available: The product instance was available.
*   UnderChange: The information about the product instance was being changed.
*   Error: An exception occurred on the product instance.', example='Available'),
      statusMessage?: string(name='StatusMessage', description='The message that is returned for the status of the product instance.

> This parameter is returned only when Error is returned for the Status parameter.', example='Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
    }
  ](name='ProvisionedProductDetails', description='The product instances.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListProvisionedProductsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProvisionedProductsResponseBody(name='body'),
}

async function listProvisionedProductsWithOptions(request: ListProvisionedProductsRequest, runtime: Util.RuntimeOptions): ListProvisionedProductsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessLevelFilter)) {
    query['AccessLevelFilter'] = request.accessLevelFilter;
  }
  if (!Util.isUnset(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProvisionedProducts',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProvisionedProducts(request: ListProvisionedProductsRequest): ListProvisionedProductsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProvisionedProductsWithOptions(request, runtime);
}

model ListRegionsResponseBody = {
  regions?: [ 
    {
      localName?: string(name='LocalName', description='The name of the region.', example='China (Hangzhou)'),
      regionEndpoint?: string(name='RegionEndpoint', description='The endpoint of the region.', example='servicecatalog.cn-hangzhou.aliyuncs.com'),
      regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
    }
  ](name='Regions', description='The details of regions.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model ListRegionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRegionsResponseBody(name='body'),
}

async function listRegionsWithOptions(runtime: Util.RuntimeOptions): ListRegionsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListRegions',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRegions(): ListRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRegionsWithOptions(runtime);
}

model ListResourcesForTagOptionRequest {
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100 Minimum value: 1. Default value: 10.', example='10'),
  resourceType?: string(name='ResourceType', description='The type of resource that is associated with the tag option. Valid values:

*   product: product
*   Portfolio: product portfolio', example='Product'),
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
}

model ListResourcesForTagOptionResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.

Valid values: 1 to 100 Minimum value: 1. Default value: 10.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='E465F21C-8712-5794-A754-5E4D9152****'),
  resourceDetails?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the resource was created.

The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-11-04T08:07:04.281986714Z'),
      description?: string(name='Description', description='The description of the resource.

The value must be 1 to 128 characters in length.', example='The description of the resource.'),
      resourceArn?: string(name='ResourceArn', description='The Alibaba Cloud Resource Name (ARN) of the resource.', example='acs:servicecatalog:cn-hangzhou:146611588617****:product/prod-bp18r7q127****'),
      resourceId?: string(name='ResourceId', description='The ID of the resource with which the tag option is associated.', example='port-bp15p96922****'),
      resourceName?: string(name='ResourceName', description='The name of the resource.', example='DEMO-ECS'),
    }
  ](name='ResourceDetails', description='An array that consists of the associated resources.'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model ListResourcesForTagOptionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListResourcesForTagOptionResponseBody(name='body'),
}

async function listResourcesForTagOptionWithOptions(request: ListResourcesForTagOptionRequest, runtime: Util.RuntimeOptions): ListResourcesForTagOptionResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourcesForTagOption',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResourcesForTagOption(request: ListResourcesForTagOptionRequest): ListResourcesForTagOptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourcesForTagOptionWithOptions(request, runtime);
}

model ListTagOptionsRequest {
  filters?: {
    active?: boolean(name='Active', description='Specifies whether to enable the tag option. Valid values:

*   true (default)
*   false', example='true'),
    fullTextSearch?: string(name='FullTextSearch', description='The full-text search method.', example='k1'),
    key?: string(name='Key', description='The key of the tag option.', example='k1'),
    value?: string(name='Value', description='The value of the tag option.', example='v1'),
  }(name='Filters', description='The filter condition.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Minimum value: 1. Default value: 10.', example='10'),
  sortBy?: string(name='SortBy', description='The information based on which you want to sort the query results.

Set the value to CreateTime, which specifies the creation time of tag options.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The order in which you want to sort the query results. Valid values:

*   Asc: the ascending order
*   Desc (default): the descending order', example='Desc'),
}

model ListTagOptionsShrinkRequest {
  filtersShrink?: string(name='Filters', description='The filter condition.'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Minimum value: 1. Default value: 10.', example='10'),
  sortBy?: string(name='SortBy', description='The information based on which you want to sort the query results.

Set the value to CreateTime, which specifies the creation time of tag options.', example='CreateTime'),
  sortOrder?: string(name='SortOrder', description='The order in which you want to sort the query results. Valid values:

*   Asc: the ascending order
*   Desc (default): the descending order', example='Desc'),
}

model ListTagOptionsResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.

Valid values: 1 to 100. Minimum value: 1. Default value: 10.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='37C9C1DF-EFFC-5D8A-80D0-8657B1F3****'),
  tagOptionDetails?: [ 
    {
      active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

*   true
*   false', example='true'),
      key?: string(name='Key', description='The key of the tag option.', example='k1'),
      owner?: string(name='Owner', description='The ID of the Alibaba Cloud account to which the tag option belongs.', example='133413081827****'),
      tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1r3mxq3t****'),
      value?: string(name='Value', description='The value of the tag option.', example='v1'),
    }
  ](name='TagOptionDetails', description='An array that consists of the details of the tag option.'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model ListTagOptionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTagOptionsResponseBody(name='body'),
}

async function listTagOptionsWithOptions(tmpReq: ListTagOptionsRequest, runtime: Util.RuntimeOptions): ListTagOptionsResponse {
  Util.validateModel(tmpReq);
  var request = new ListTagOptionsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filters)) {
    request.filtersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filters, 'Filters', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagOptions',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTagOptions(request: ListTagOptionsRequest): ListTagOptionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagOptionsWithOptions(request, runtime);
}

model ListTasksRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  provisionedProductId?: string(name='ProvisionedProductId', example='pp-bp1ddg1n2a****'),
  sortBy?: string(name='SortBy', example='CreateTime'),
  sortOrder?: string(name='SortOrder', example='Desc'),
}

model ListTasksResponseBody = {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
  taskDetails?: [ 
    {
      createTime?: string(name='CreateTime', example='2022-05-23T09:46:27Z'),
      log?: {
        terraformLogs?: [ 
          {
            command?: string(name='Command', example='apply'),
            content?: string(name='Content', example='Apply complete! Resources: 42 added, 0 changed, 0 destroyed.'),
            stream?: string(name='Stream', example='stdout'),
          }
        ](name='TerraformLogs'),
      }(name='Log'),
      outputs?: [ 
        {
          description?: string(name='Description', example='The ECS instance ID.'),
          outputKey?: string(name='OutputKey', example='instance_id'),
          outputValue?: string(name='OutputValue', example='i-xxxxxx'),
        }
      ](name='Outputs'),
      parameters?: [ 
        {
          parameterKey?: string(name='ParameterKey', example='instance_type'),
          parameterValue?: string(name='ParameterValue', example='ecs.s6-c1m1.small'),
        }
      ](name='Parameters'),
      portfolioId?: string(name='PortfolioId', example='port-bp1yt7582g****'),
      productId?: string(name='ProductId', example='prod-bp18r7q127****'),
      productName?: string(name='ProductName'),
      productVersionId?: string(name='ProductVersionId', example='pv-bp15e79d26****'),
      productVersionName?: string(name='ProductVersionName', example='1.0'),
      provisionedProductId?: string(name='ProvisionedProductId', example='pp-bp1ddg1n2a****'),
      provisionedProductName?: string(name='ProvisionedProductName'),
      status?: string(name='Status', example='Succeeded'),
      statusMessage?: string(name='StatusMessage', example='Resource CREATE failed: terraform stack sc-146611588617****-pp-bp1ddg1n2a**** failure...'),
      taskId?: string(name='TaskId', description='代表资源名称的资源属性字段', example='task-bp1dmg242c****'),
      taskType?: string(name='TaskType', example='LaunchProduct'),
      updateTime?: string(name='UpdateTime', example='2022-05-26T03:28:45Z'),
    }
  ](name='TaskDetails'),
  totalCount?: int32(name='TotalCount', example='2'),
}

model ListTasksResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTasksResponseBody(name='body'),
}

async function listTasksWithOptions(request: ListTasksRequest, runtime: Util.RuntimeOptions): ListTasksResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.provisionedProductId)) {
    query['ProvisionedProductId'] = request.provisionedProductId;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sortOrder)) {
    query['SortOrder'] = request.sortOrder;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTasks',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTasks(request: ListTasksRequest): ListTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTasksWithOptions(request, runtime);
}

model TerminateProvisionedProductRequest {
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
}

model TerminateProvisionedProductResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model TerminateProvisionedProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TerminateProvisionedProductResponseBody(name='body'),
}

/**
  * After a product instance is terminated, the product instance is deleted from the product instance list. End users cannot manage the product instance throughout its lifecycle. Proceed with caution.
  *
  * @param request TerminateProvisionedProductRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return TerminateProvisionedProductResponse
 */
async function terminateProvisionedProductWithOptions(request: TerminateProvisionedProductRequest, runtime: Util.RuntimeOptions): TerminateProvisionedProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.provisionedProductId)) {
    body['ProvisionedProductId'] = request.provisionedProductId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TerminateProvisionedProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * After a product instance is terminated, the product instance is deleted from the product instance list. End users cannot manage the product instance throughout its lifecycle. Proceed with caution.
  *
  * @param request TerminateProvisionedProductRequest
  * @return TerminateProvisionedProductResponse
 */
async function terminateProvisionedProduct(request: TerminateProvisionedProductRequest): TerminateProvisionedProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return terminateProvisionedProductWithOptions(request, runtime);
}

model UpdateConstraintRequest {
  config?: string(name='Config', description='The configurations of the constraint.

Format: { "LocalRoleName": "\\<role_name>" }.', example='{ "LocalRoleName": "TestRole" }'),
  constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
  description?: string(name='Description', description='The description of the constraint.

The value must be 1 to 128 characters in length.', example='Launch as local role TestRole'),
}

model UpdateConstraintResponseBody = {
  constraintId?: string(name='ConstraintId', description='The ID of the constraint.', example='cons-bp1yx7x42v****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model UpdateConstraintResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateConstraintResponseBody(name='body'),
}

async function updateConstraintWithOptions(request: UpdateConstraintRequest, runtime: Util.RuntimeOptions): UpdateConstraintResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.config)) {
    body['Config'] = request.config;
  }
  if (!Util.isUnset(request.constraintId)) {
    body['ConstraintId'] = request.constraintId;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateConstraint',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateConstraint(request: UpdateConstraintRequest): UpdateConstraintResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateConstraintWithOptions(request, runtime);
}

model UpdatePortfolioRequest {
  description?: string(name='Description', description='产品组合描述'),
  portfolioId?: string(name='PortfolioId', description='代表资源一级ID的资源属性字段', example='port-bp1yt7582g****'),
  portfolioName?: string(name='PortfolioName', description='代表资源名称的资源属性字段'),
  providerName?: string(name='ProviderName', description='产品组合提供方'),
}

model UpdatePortfolioResponseBody = {
  portfolioId?: string(name='PortfolioId', example='port-bp1yt7582g****'),
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model UpdatePortfolioResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdatePortfolioResponseBody(name='body'),
}

async function updatePortfolioWithOptions(request: UpdatePortfolioRequest, runtime: Util.RuntimeOptions): UpdatePortfolioResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.portfolioName)) {
    body['PortfolioName'] = request.portfolioName;
  }
  if (!Util.isUnset(request.providerName)) {
    body['ProviderName'] = request.providerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdatePortfolio',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updatePortfolio(request: UpdatePortfolioRequest): UpdatePortfolioResponse {
  var runtime = new Util.RuntimeOptions{};
  return updatePortfolioWithOptions(request, runtime);
}

model UpdateProductRequest {
  description?: string(name='Description', description='产品描述'),
  productId?: string(name='ProductId', description='代表资源一级ID的资源属性字段', example='prod-bp18r7q127****'),
  productName?: string(name='ProductName', description='代表资源名称的资源属性字段'),
  providerName?: string(name='ProviderName', description='产品提供方'),
}

model UpdateProductResponseBody = {
  productId?: string(name='ProductId', example='prod-bp18r7q127****'),
  requestId?: string(name='RequestId', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model UpdateProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateProductResponseBody(name='body'),
}

async function updateProductWithOptions(request: UpdateProductRequest, runtime: Util.RuntimeOptions): UpdateProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productName)) {
    body['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.providerName)) {
    body['ProviderName'] = request.providerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateProduct(request: UpdateProductRequest): UpdateProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateProductWithOptions(request, runtime);
}

model UpdateProductVersionRequest {
  active?: boolean(name='Active', description='Specifies whether to enable the product version. Valid values:

*   true: enables the product version. This is the default value.
*   false: disables the product version.', example='true'),
  description?: string(name='Description', description='The description of the product version.

The value must be 1 to 128 characters in length.', example='The description of the product version.'),
  guidance?: string(name='Guidance', description='The recommendation information. Valid values:

*   Default: No recommendation information is provided. This is the default value.
*   Recommended: the recommended version.
*   Latest: the latest version.
*   Deprecated: the version that is about to be discontinued.', example='Default'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  productVersionName?: string(name='ProductVersionName', description='The name of the product version.

The value must be 1 to 128 characters in length.', example='1.0'),
}

model UpdateProductVersionResponseBody = {
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model UpdateProductVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateProductVersionResponseBody(name='body'),
}

async function updateProductVersionWithOptions(request: UpdateProductVersionRequest, runtime: Util.RuntimeOptions): UpdateProductVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.active)) {
    body['Active'] = request.active;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.guidance)) {
    body['Guidance'] = request.guidance;
  }
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  if (!Util.isUnset(request.productVersionName)) {
    body['ProductVersionName'] = request.productVersionName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateProductVersion',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateProductVersion(request: UpdateProductVersionRequest): UpdateProductVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateProductVersionWithOptions(request, runtime);
}

model UpdateProvisionedProductRequest {
  parameters?: [ 
    {
      parameterKey?: string(name='ParameterKey', description='The name of the input parameter for the template.', example='instance_type'),
      parameterValue?: string(name='ParameterValue', description='The value of the input parameter for the template.', example='ecs.s6-c1m1.small'),
    }
  ](name='Parameters', description='The input parameters of the template.

You can specify up to 200 parameters.

> - This parameter is optional. If you specify the Parameters parameter, you must specify the ParameterKey and ParameterValue parameters.
> - If the values of the ProductVersionId and Parameters parameters are not changed, you are not allowed to update the information about the product instance.'),
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.

> The PortfolioId parameter is not required if the default launch option exists. The PortfolioId parameter is required if the default launch option does not exist. For more information about how to obtain the value of the PortfolioId parameter, see [ListLaunchOptions](~~ListLaunchOptions~~).', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.

> If the values of the ProductVersionId and Parameters parameters are not changed, the information about the product instance cannot be updated.', example='pv-bp15e79d26****'),
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
  tags?: [ 
    {
      key?: string(name='Key', description='The tag key of the custom tag.

The tag key must be 1 to 128 characters in length and cannot contain `http://` or `https://`. It cannot start with `acs:` or `aliyun`.', example='k1'),
      value?: string(name='Value', description='The tag value of the custom tag.

The tag value can be up to 128 characters in length and cannot start with `acs:`. It cannot contain `http://` or `https://`.', example='v1'),
    }
  ](name='Tags', description='The input custom tags.

Maximum value of N: 20.

> - The Tags parameter is optional. If you need to specify the Tags parameter, you must specify the Tags.N.Key and Tags.N.Value parameters.
> - The tag is propagated to each stack resource that supports the tag feature.'),
}

model UpdateProvisionedProductResponseBody = {
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F81BF'),
}

model UpdateProvisionedProductResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateProvisionedProductResponseBody(name='body'),
}

async function updateProvisionedProductWithOptions(request: UpdateProvisionedProductRequest, runtime: Util.RuntimeOptions): UpdateProvisionedProductResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.parameters)) {
    body['Parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  if (!Util.isUnset(request.provisionedProductId)) {
    body['ProvisionedProductId'] = request.provisionedProductId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateProvisionedProduct',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateProvisionedProduct(request: UpdateProvisionedProductRequest): UpdateProvisionedProductResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateProvisionedProductWithOptions(request, runtime);
}

model UpdateProvisionedProductPlanRequest {
  description?: string(name='Description', description='The description of the plan.', example='Create an ECS instance.'),
  parameters?: [ 
    {
      parameterKey?: string(name='ParameterKey', description='The name of the parameter in the template.', example='instance_type'),
      parameterValue?: string(name='ParameterValue', description='The value of the parameter in the template.', example='ecs.s6-c1m1.small'),
    }
  ](name='Parameters', description='An array that consists of the parameters in the template.

Maximum value of N: 200.

> If you specify Parameters, you must specify ParameterKey and ParameterValue.'),
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
  portfolioId?: string(name='PortfolioId', description='The ID of the product portfolio.

> If the default launch option exists, you do not need to specify PortfolioId. If the default launch option does not exist, you must specify PortfolioId. For more information about how to obtain the value of PortfolioId, see [ListLaunchOptions](~~ListLaunchOptions~~).', example='port-bp1yt7582g****'),
  productId?: string(name='ProductId', description='The ID of the product.', example='prod-bp18r7q127****'),
  productVersionId?: string(name='ProductVersionId', description='The ID of the product version.', example='pv-bp15e79d26****'),
  tags?: [ 
    {
      key?: string(name='Key', description='The key of the custom tag.

The key can be up to 128 characters in length, and cannot start with `acs:` or `aliyun`. The tag key cannot contain `http://` or `https://`.', example='k1'),
      value?: string(name='Value', description='The value of the custom tag.

The value can be up to 128 characters in length, and cannot start with `acs:`. The tag value cannot contain `http://` or `https://`.', example='v1'),
    }
  ](name='Tags', description='An array that consists of custom tags.

Maximum value of N: 20.

> 
*   If you specify Tags, you must specify Tags.N.Key and Tags.N.Value.
*   The tag of a stack is propagated to each resource that supports the tag feature in the stack.'),
}

model UpdateProvisionedProductPlanResponseBody = {
  planId?: string(name='PlanId', description='The ID of the plan.', example='plan-bp1jvmdk2k****'),
  provisionedProductId?: string(name='ProvisionedProductId', description='The ID of the product instance.', example='pp-bp1ddg1n2a****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
}

model UpdateProvisionedProductPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateProvisionedProductPlanResponseBody(name='body'),
}

async function updateProvisionedProductPlanWithOptions(request: UpdateProvisionedProductPlanRequest, runtime: Util.RuntimeOptions): UpdateProvisionedProductPlanResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.parameters)) {
    body['Parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.planId)) {
    body['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.portfolioId)) {
    body['PortfolioId'] = request.portfolioId;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  if (!Util.isUnset(request.productVersionId)) {
    body['ProductVersionId'] = request.productVersionId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateProvisionedProductPlan',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateProvisionedProductPlan(request: UpdateProvisionedProductPlanRequest): UpdateProvisionedProductPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateProvisionedProductPlanWithOptions(request, runtime);
}

model UpdateTagOptionRequest {
  active?: boolean(name='Active', description='Specifies whether to enable the tag option. Valid values:

*   true (default)
*   false', example='true'),
  tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
  value?: string(name='Value', description='The value of the tag option.

The value can be up to 128 characters in length. It cannot start with `acs:` and cannot contain `http://` or `https://`.', example='v1'),
}

model UpdateTagOptionResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FEEF92D-4052-5202-87D0-3D8EC16F****'),
  tagOptionDetail?: {
    active?: boolean(name='Active', description='Indicates whether the tag option is enabled. Valid values:

*   true (default)
*   false', example='true'),
    key?: string(name='Key', description='The key of the tag option.

The key must be 1 to 128 characters in length. It cannot contain `http://` or `https://` and cannot start with `acs:` or `aliyun`.', example='k1'),
    owner?: string(name='Owner', description='The ID of the Alibaba Cloud account to which the tag option belongs.', example='133413081827****'),
    tagOptionId?: string(name='TagOptionId', description='The ID of the tag option.', example='tag-bp1u6mdf3d****'),
    value?: string(name='Value', description='The value of the tag option.

The value must be 1 to 128 characters in length. It cannot contain `http://` or `https://` and cannot start with `acs:` or `aliyun`.', example='v1'),
  }(name='TagOptionDetail', description='The details of the tag option.'),
}

model UpdateTagOptionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateTagOptionResponseBody(name='body'),
}

async function updateTagOptionWithOptions(request: UpdateTagOptionRequest, runtime: Util.RuntimeOptions): UpdateTagOptionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.active)) {
    body['Active'] = request.active;
  }
  if (!Util.isUnset(request.tagOptionId)) {
    body['TagOptionId'] = request.tagOptionId;
  }
  if (!Util.isUnset(request.value)) {
    body['Value'] = request.value;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTagOption',
    version = '2021-09-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTagOption(request: UpdateTagOptionRequest): UpdateTagOptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTagOptionWithOptions(request, runtime);
}

